magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(magician)

magicians = ['alice', 'david', 'carolina']
for magician in range(0,3):
    print(magicians[magician])


digits = [1,8,6,9,2,4,7,3,5]
print("最小值：",min(digits))
print("最大值：",max(digits))
print("和：",sum(digits))

#数组的最大值最小值求取以及和
leizhu = digits[0]
for num in digits:
    if num < leizhu:
        leizhu = num
print("最小值：",leizhu)

leizhu = digits[0]
for num in digits:
    if num > leizhu:
        leizhu = num
print("最大值：",leizhu)

sum=0
for num in digits:
    sum=sum+num
print("和：",sum)


                                                                      # 冒泡排序
# # 两个变量的值进行呼唤
# a=6
# b=9
# c=a
# a=b
# b=c
# print(a,b)
#递增
digits = [1,8,6,9,2,4,7,3,5]
for i in range(0,len(digits)-1):
    for j in range(0,len(digits)-1-i):
        if digits[j]>digits[j+1]:
            a = digits[j]
            digits[j] = digits[j+1]
            digits[j+1] = a
print(digits)
#递减
digits = [1,8,6,9,2,4,7,3,5]
for i in range(0,len(digits)-1):
    for j in range(0,len(digits)-1-i):
        if digits[j]<digits[j+1]:
            a = digits[j]
            digits[j] = digits[j+1]
            digits[j+1] = a
print(digits)
